package Api;

import jdk.nashorn.internal.runtime.regexp.joni.Regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author 28021
 * @Date 2022/11/22
 */
public class re {
    public static void main(String[] args) {
        String str="javaDjskdj 法第三空间java8驸马恐龙进教室java11打飞机啊看是否java17";
//        String r1 = str.replaceAll("\\w{3}","换掉");
//        System.out.println(r1);
        System.out.println(str.split("(java)(8|11|17)"));
        String regex="(java)(8|11|17)";
        String regex2="(java)(?=8|11|17)";
        String regex3="(java)(?:8|11|17)";
        String regex4="(java)(?!8|11|17)";
        Pattern p = Pattern.compile(regex4);
        Matcher m = p.matcher(str);
        while (m.find()){
            System.out.println(m.group());
        }
    }
}
